<?php
	
	$con=mysqli_connect('localhost','root','', 'chongqinghuoguo110');
	if($con){
		mysqli_set_charset($con, 'utf8');
		$sql='select * from news limit 4';
		$result=mysqli_query($con,$sql);
		$arr=mysqli_fetch_all($result,MYSQLI_ASSOC);
	 	$str = json_encode($arr);
	    echo $str;
	}else{
		echo '链接未遂'.mysqli_connect_error();
	};
	
	mysqli_close($con)
	
	
	
	?>